package main

import (
	"github.com/gin-gonic/gin"
)

type LoginForm struct {
	User     string `form:"user" binding:"required"`
	Password string `form:"password" binding:"required"`
}

func main() {
	r := gin.Default()
	r.POST("/multipartUrlEncode", func(ctx *gin.Context) {
		var loginForm LoginForm
		err := ctx.ShouldBind(&loginForm)
		if err == nil {
			if loginForm.User == "user" && loginForm.Password == "password" {
				ctx.JSON(200, gin.H{
					"status": "login success",
				})
			} else {
				ctx.JSON(401, gin.H{
					"status": "login failed",
				})
			}
		}
	})
	r.Run()
}
